package com.nbsaas.boot.manufacturing.rest.resource;

import com.nbsaas.boot.manufacturing.api.apis.WorkCenterApi;
import com.nbsaas.boot.manufacturing.data.entity.WorkCenter;
import com.nbsaas.boot.manufacturing.api.domain.request.WorkCenterRequest;
import com.nbsaas.boot.manufacturing.api.domain.response.WorkCenterResponse;
import com.nbsaas.boot.manufacturing.api.domain.simple.WorkCenterSimple;
import com.nbsaas.boot.manufacturing.rest.convert.WorkCenterSimpleConvert;
import com.nbsaas.boot.manufacturing.rest.convert.WorkCenterEntityConvert;
import com.nbsaas.boot.manufacturing.rest.convert.WorkCenterResponseConvert;
import com.nbsaas.boot.manufacturing.data.repository.WorkCenterRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   工作中心-业务接口实现
*/
@Transactional
@Service
public class WorkCenterResource extends BaseResource<WorkCenter,WorkCenterResponse, WorkCenterSimple, WorkCenterRequest>  implements WorkCenterApi {

    @Resource
    private WorkCenterRepository workCenterRepository;

    @Override
    public JpaRepositoryImplementation<WorkCenter, Serializable> getJpaRepository() {
        return workCenterRepository;
    }

    @Override
    public Function<WorkCenter, WorkCenterSimple> getConvertSimple() {
        return new WorkCenterSimpleConvert();
    }

    @Override
    public Function<WorkCenterRequest, WorkCenter> getConvertForm() {
        return new WorkCenterEntityConvert();
    }

    @Override
    public Function<WorkCenter, WorkCenterResponse> getConvertResponse() {
        return new WorkCenterResponseConvert();
    }




}


